<?php
/**
 *
 * User: wufeng
 * Date: 2020/03/07
 */

namespace app\parent\controller\v1;
use app\common\controller\ParentController;
use app\parent\service\MyService;

class My extends ParentController
{
	/**
	 * 我的班级
	 * User: wufeng
	 * Date: 2020/03/09
	 *
	 */
	public function myClass()
	{
		if ($this->request->isPost()) {
			$list = (new MyService($this->type))->myClass();
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 考勤记录
	 * User: wufeng
	 * Date: 2020/03/09
	 *
	 */
	public function attendanceRecord()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new MyService($this->type))->attendanceRecord($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 我的请假
	 * User: wufeng
	 * Date: 2020/03/09
	 *
	 */
	public function myLeave()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new MyService($this->type))->myLeave($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 提交申请
	 * User: wufeng
	 * Date: 2020/03/07
	 *
	 */
	public function launchApproval()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new MyService($this->type))->launchApproval($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 缴费记录
	 * User: wufeng
	 * Date: 2020/03/08
	 *
	 */
	public function paymentRecord()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new MyService($this->type))->paymentRecord($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 投诉建议
	 * User: wufeng
	 * Date: 2020/03/09
	 *
	 */
	public function complaintSuggestion()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new MyService($this->type))->complaintSuggestion($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * User: wufeng
	 * Date: 2020/03/12
	 *
	 */
	public function information()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new MyService($this->type))->information($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 是否阅读
	 * User: wufeng
	 * Date: 2020/03/14
	 *
	 */
	public function isRead()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new MyService($this->type))->isRead($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 上传头像
	 * User: wufeng
	 * Date: 2020/03/30
	 *
	 */
	public function uploadHead()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new MyService($this->type))->uploadHead($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}
}